using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_pharmainvMap : EntityTypeConfiguration<so_pharmainv>
    {
        public so_pharmainvMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Number, t.date, t.Document_ID, t.Salesman });

            // Properties
            this.Property(t => t.Customer)
                .HasMaxLength(35);

            this.Property(t => t.Number)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.Document_type)
                .HasMaxLength(7);

            this.Property(t => t.Currency)
                .HasMaxLength(5);

            this.Property(t => t.Batch__)
                .HasMaxLength(10);

            this.Property(t => t.Salesman)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("so_pharmainv");
            this.Property(t => t.Customer).HasColumnName("Customer");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.Document_ID).HasColumnName("Document_ID");
            this.Property(t => t.Document_type).HasColumnName("Document_type");
            this.Property(t => t.Total).HasColumnName("Total");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.closedout).HasColumnName("closedout");
            this.Property(t => t.Batch__).HasColumnName("Batch_#");
            this.Property(t => t.Salesman).HasColumnName("Salesman");
        }
    }
}
